
use "$LocalData\CRA_RegData.dta", clear


keep if  !missing(bartikGS1) & !missing(gSmallFirm1) & !missing(gsmall_dep1)  & !missing(sbgrowth1m)  & !missing(sbgrowth250k) & abs(sbgrowth1m)<5 & abs(sbgrowth250k)<5


sort geography year
by geography year: gen geoN = _N


preserve 
keep if geoN>=10

*local controls ln_pop_2000 unem_2000 urban_2000 lnincome2000 lnbr2000 small_dep_share2000 
local controls 	dlngdp unem_change pop_growth annualchange 

eststo: reghdfe sbgrowth1m gSmallFirm1 `controls' if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex replace ///
	ctitle(Delta(SBLoans1m)) keep(gSmallFirm1  `controls' ) ///
	addtext(REG, OLS, F-Stat, Bank-YEAR FE, YES, COUNTY FE, NO, YRS, 2003-2017)
eststo: reghdfe sbgrowth1m gSmallFirm1 gLargeFirm1  `controls'  if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans1m)) keep(gSmallFirm1 gLargeFirm1 `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, NO, YRS, 2003-2017)
eststo: reghdfe sbgrowth1m gSmallFirm1 if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear geography) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans1m)) keep(gSmallFirm1  `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, YES, YRS, 2003-2017)
eststo: reghdfe sbgrowth1m gSmallFirm1 gLargeFirm1 if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear geography) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans1m)) keep(gSmallFirm1 gLargeFirm1 `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, YES, YRS, 2003-2017)
	
	
eststo: reghdfe sbgrowth250k gSmallFirm1 `controls' if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans250k)) keep(gSmallFirm1  `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, NO, YRS, 2003-2017)
eststo: reghdfe sbgrowth250k gSmallFirm1 gLargeFirm1  `controls'  if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans250k)) keep(gSmallFirm1 gLargeFirm1 `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, NO, YRS, 2003-2017)
eststo: reghdfe sbgrowth250k gSmallFirm1 if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear geography) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans250k)) keep(gSmallFirm1  `controls' ) ///
	addtext(REG, OLS, F-Stat, N/A, Bank-YEAR FE, YES, COUNTY FE, YES, YRS, 2003-2017)
eststo: reghdfe sbgrowth250k gSmallFirm1 gLargeFirm1 if abs(sbgrowth1m)<5 & year>2002, absorb(entityyear geography) vce(cluster cluster3 id_rssd)
outreg2 using "$LocalData\Tables\RFS_LoanDemand", tex append ///
	ctitle(Delta(SBLoans250k)) keep(gSmallFirm1 gLargeFirm1 `controls' ) ///
	addtext(REG, OLS, Bank-YEAR FE, YES, COUNTY FE, YES, YRS, 2003-2017)


restore


